package forms;

import java.util.*;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;

public class ChairsForm extends ActionForm
{
	private static final long serialVersionUID = 1L;
	
	private int numReviewers;
	private String reviewer;
	private String password;

	public void setNumReviewers(int rev) {
		this.numReviewers = rev;
	}
	public int getNumReviewers() {
		return numReviewers;
	}
	public void setReviewer(String rev) {
		this.reviewer = rev;
	}
	public String getReviewer() {
		return reviewer;
	}
	public void setPassword(String p) {
		this.password = p;
	}
	public String getPassword() {
		return password;
	}
	
	public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
		if (request.getRequestURI().equals("/struts/chair/startReview.do")) {
			if (numReviewers < 2)
			errors.add("idMsgTag1", new ActionMessage("errors.required", "You must provide at least two reviewers before the process is initiated"));

		}
		return errors;
	}
}
